import java.util.concurrent.*;
/**
 * BroadcastHandler
 * Distributes outgoing messages to other server threads incoming message queue.
 * 
 * @author James Varvaro
 */
public class BroadcastHandler extends Thread {
    private ConcurrentLinkedQueue<BroadcastDrop> bd;
    public BroadcastHandler(ConcurrentLinkedQueue<BroadcastDrop> abd) {
        this.bd = abd;
    }
    
    public void run() {
        while(true) {
           for(BroadcastDrop out : bd) {
               String msg = null;
               while((msg = out.pollOut()) != null) {
                    for(BroadcastDrop in : bd) {
                        in.putIn(msg);
                    }
               }
           }
        }
    }
}
